home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3388 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.0 KB

  1. Path: zilker.net!usenet
  2. From: Jeff PErry <jeff@jsp.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: C++ Wizard Question
  5. Date: Tue, 23 Jan 1996 13:15:09 -0600
  6. Organization: Zilker Internet Park, Inc.
  7. Message-ID: <310533BD.847@jsp.com>
  8. NNTP-Posting-Host: jsp.com
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0b4 (WinNT; I)
  13.  
  14. So, you think you're a C++ Wizard, eh?  Good.  Then could you 
  15. please comment on the following few statements:
  16.  
  17.     throw "This is an exception thrown deep in the call stack";
  18.  
  19.     ...
  20.  
  21.     catch (const char *E)
  22.     {
  23.         // Do something with E
  24.     }
  25.  
  26. This is a practice that I have used before, and only recently 
  27. did it occur to me that it might not be such a great idea to be 
  28. throwing a pointer to something on the stack.  On the other 
  29. hand, it is a constant, so it has to live somewhere permanently.
  30.  
  31. The question is: Is it safe to assume that the string to which E 
  32. points will be valid in my catch block, even though the call 
  33. stack has been unwound?
  34.  
  35. Thanks in advance,
  36. JEFF
  37.